
package com.jf.cloud.distribution.controller.app;

import com.jf.cloud.common.database.dto.PageDTO;
import com.jf.cloud.common.database.vo.PageVO;
import com.jf.cloud.common.response.ServerResponseEntity;
import com.jf.cloud.distribution.model.DistributionMsg;
import com.jf.cloud.distribution.service.DistributionMsgService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 分销公告信息
 *
 * @author zz
 * @date 2021-08-09 14:14:05
 */
@RestController("appDistributionMsgController")
@RequestMapping("/distribution_msg")
@Tag(name = "app-分销公告信息")
public class DistributionMsgController {

    @Autowired
    private DistributionMsgService distributionMsgService;

    @GetMapping("/page")
    @Operation(summary = "获取分销公告信息列表" , description = "分页获取分销公告信息列表")
    public ServerResponseEntity<PageVO<DistributionMsg>> page(@Valid PageDTO pageDTO, @RequestParam(value = "isTop", required = false) Integer isTop) {
        PageVO<DistributionMsg> distributionMsgPage = distributionMsgService.pageApp(pageDTO,isTop);
        return ServerResponseEntity.success(distributionMsgPage);
    }

    @GetMapping
    @Operation(summary = "获取分销公告信息" , description = "根据msgId获取分销公告信息")
    public ServerResponseEntity<DistributionMsg> getByMsgId(@RequestParam Long msgId) {
        return ServerResponseEntity.success(distributionMsgService.getByMsgId(msgId));
    }
}
